home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / fontconfig / fcprivate.h < prev    next >
C/C++ Source or Header  |  2005-10-16  |  4KB  |  124 lines

  1. /*
  2.  * $RCSId: xc/lib/fontconfig/fontconfig/fcprivate.h,v 1.5 2002/08/19 19:32:04 keithp Exp $
  3.  *
  4.  * Copyright ⌐ 2001 Keith Packard
  5.  *
  6.  * Permission to use, copy, modify, distribute, and sell this software and its
  7.  * documentation for any purpose is hereby granted without fee, provided that
  8.  * the above copyright notice appear in all copies and that both that
  9.  * copyright notice and this permission notice appear in supporting
  10.  * documentation, and that the name of Keith Packard not be used in
  11.  * advertising or publicity pertaining to distribution of the software without
  12.  * specific, written prior permission.  Keith Packard makes no
  13.  * representations about the suitability of this software for any purpose.  It
  14.  * is provided "as is" without express or implied warranty.
  15.  *
  16.  * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  17.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  18.  * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  19.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  20.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  21.  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  22.  * PERFORMANCE OF THIS SOFTWARE.
  23.  */
  24.  
  25. #ifndef _FCPRIVATE_H_
  26. #define _FCPRIVATE_H_
  27.  
  28. /*
  29.  * I tried this with functions that took va_list* arguments
  30.  * but portability concerns made me change these functions
  31.  * into macros (sigh).
  32.  */
  33.  
  34. #define FcPatternVapBuild(result, orig, va)                \
  35. {                                    \
  36.     FcPattern    *__p__ = (orig);                    \
  37.     const char    *__o__;                            \
  38.     FcValue    __v__;                            \
  39.                                     \
  40.     if (!__p__)                                \
  41.     {                                    \
  42.     __p__ = FcPatternCreate ();                    \
  43.     if (!__p__)                                \
  44.         goto _FcPatternVapBuild_bail0;                \
  45.     }                                        \
  46.     for (;;)                                    \
  47.     {                                        \
  48.     __o__ = va_arg (va, const char *);                \
  49.     if (!__o__)                                \
  50.         break;                                \
  51.     __v__.type = va_arg (va, FcType);                \
  52.     switch (__v__.type) {                            \
  53.     case FcTypeVoid:                        \
  54.         goto _FcPatternVapBuild_bail1;                   \
  55.     case FcTypeInteger:                            \
  56.         __v__.u.i = va_arg (va, int);                \
  57.         break;                            \
  58.     case FcTypeDouble:                        \
  59.         __v__.u.d = va_arg (va, double);                \
  60.         break;                            \
  61.     case FcTypeString:                        \
  62.         __v__.u.s = va_arg (va, FcChar8 *);                \
  63.         break;                            \
  64.     case FcTypeBool:                        \
  65.         __v__.u.b = va_arg (va, FcBool);                \
  66.         break;                            \
  67.     case FcTypeMatrix:                        \
  68.         __v__.u.m = va_arg (va, FcMatrix *);            \
  69.         break;                            \
  70.     case FcTypeCharSet:                        \
  71.         __v__.u.c = va_arg (va, FcCharSet *);            \
  72.         break;                            \
  73.     case FcTypeFTFace:                        \
  74.         __v__.u.f = va_arg (va, FT_Face);                \
  75.         break;                            \
  76.     case FcTypeLangSet:                        \
  77.         __v__.u.l = va_arg (va, FcLangSet *);            \
  78.         break;                            \
  79.     }                                \
  80.     if (!FcPatternAdd (__p__, __o__, __v__, FcTrue))        \
  81.         goto _FcPatternVapBuild_bail1;                \
  82.     }                                    \
  83.     result = __p__;                            \
  84.     goto _FcPatternVapBuild_return;                    \
  85.                                     \
  86. _FcPatternVapBuild_bail1:                        \
  87.     if (!orig)                                \
  88.     FcPatternDestroy (__p__);                    \
  89. _FcPatternVapBuild_bail0:                        \
  90.     result = (void*)0;                            \
  91.                                     \
  92. _FcPatternVapBuild_return:                        \
  93.     ;                                    \
  94. }
  95.  
  96.  
  97. #define FcObjectSetVapBuild(__ret__, __first__, __va__)         \
  98. {                                    \
  99.     FcObjectSet    *__os__;                        \
  100.     const char        *__ob__;                        \
  101.                                     \
  102.     __ret__ = 0;                                \
  103.     __os__ = FcObjectSetCreate ();                    \
  104.     if (!__os__)                            \
  105.     goto _FcObjectSetVapBuild_bail0;                \
  106.     __ob__ = __first__;                            \
  107.     while (__ob__)                            \
  108.     {                                    \
  109.     if (!FcObjectSetAdd (__os__, __ob__))                \
  110.         goto _FcObjectSetVapBuild_bail1;                \
  111.     __ob__ = va_arg (__va__, const char *);                \
  112.     }                                    \
  113.     __ret__ = __os__;                            \
  114.                                     \
  115. _FcObjectSetVapBuild_bail1:                        \
  116.     if (!__ret__ && __os__)                            \
  117.     FcObjectSetDestroy (__os__);                    \
  118. _FcObjectSetVapBuild_bail0:                        \
  119.     ;                                    \
  120. }
  121.  
  122. #endif /* _FCPRIVATE_H_ */
  123.  
  124.